Add poll() support to xenbus device file.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 20 Mar 2006 11:00:58 +0000 (12:00 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 20 Mar 2006 11:00:58 +0000 (12:00 +0100)
From: Gerd Hoffmann
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c

index 9b51e4b4ebb89faab5885fce89e1960eb2c8cc0b..8f748dc41d9aa1224bb0ff34aeb45413951940f6 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/notifier.h>
 #include <linux/wait.h>
 #include <linux/fs.h>
+#include <linux/poll.h>
 
 #include "xenbus_comms.h"
 
@@ -207,11 +208,22 @@ static int xenbus_dev_release(struct inode *inode, struct file *filp)
        return 0;
 }
 
+static unsigned int xenbus_dev_poll(struct file *file, poll_table *wait)
+{
+       struct xenbus_dev_data *u = file->private_data;
+
+       poll_wait(file, &u->read_waitq, wait);
+       if (u->read_cons != u->read_prod)
+               return POLLIN | POLLRDNORM;
+       return 0;
+}
+
 static struct file_operations xenbus_dev_file_ops = {
        .read = xenbus_dev_read,
        .write = xenbus_dev_write,
        .open = xenbus_dev_open,
        .release = xenbus_dev_release,
+       .poll = xenbus_dev_poll,
 };
 
 static int __init